home *** CD-ROM | disk | FTP | other *** search
-
- MODEST MENGINE (MGN.EXE) { (c) April, 1989 by Ed Keefe,
- CIS 73277,1064] and, hereby, placed
- in the public domain.}
-
- PURPOSE
-
- MGN is a Menu Engine. It contains most of the logic to put a
- simple, light-bar menu on the screen. You provide an ASCII
- text file with the data for the menu engine. You also provide
- a a suitable batch file that will use the MGN program.
-
- TYPICAL COMMAND TO RUN MGN
-
- MGN MNU.FIL
-
- where MNU.FIL is an an ASCII text file containing one to ten
- lines with the following format.
-
- H|V Row Column ItemWord_0[*] ItemWord-1[*]...ItemWord_9 ExitWord
-
- where "H|V" indicates a Horizontal or Vertical (sub)menu
-
- "Row Column" are numbers indicating where to display the menu
-
- "ItemWord-n[*]" is a word describing an option in the menu. If
- the word contains an asterisk, MGN will assume that this
- ItemWord will call for a submenu.
-
- LIMITATIONS
-
- MGN is modest. It does not contain extensive error trapping.
- It does not use the EXEC() operator, nor does the program
- terminate and stay resident.
-
- It has been designed and tested for menu systems containing a
- main menu and, at most, one sublevel of menus. Both the main
- and sub menus may contain, at most, ten options. MGN produces
- either 1-2-3 or Borland style menus. In its present form, MGN
- produces a DOS errorlevel number corresponding to the item in
- the menu. This DOS errorlevel number can be tested within a
- batch file. (A sample batch file, "M.BAT", is included in this
- suite of files).
-
- Users of Turbo Pascal 4/5 are encouraged to enhance the MGN
- program. Source code is provided. MGN is placed in the public
- domain. You may freely copy and distribute the program in part
- or whole. If you use most, or all of the code in MGN in a
- program that you distribute, then intellectual honesty
- suggests that you include a reference to the original code,
- and its author, in your program.
-
- Support for MGN is also very modest. There is no quarantee
- with the program. MGN, and its attendant files, are offered
- as-is. It is up to the user to determine if MGN is suitable
- for use and, if not, to make it suitable.
-
-
- HOW TO USE MGN
-
- Running the sample program.
-
- Extract MGN.EXE, MGN.MNU, M.BAT and QUIT.BAT from this
- archived file.
-
- At the DOS prompt, type M and press Return.
-
- Provided you are using a color monitor, the main menu will
- appear on row 10 of the monitor. The menu is coded for yellow
- letters on a brown background. The lighbar is coded for black
- letters on a lightgray background. It is a "horizontal" menu,
- a la 1-2-3.
-
- You may exit the main menu by pressing ESC or by moving the
- lightbar to [ Exit ] and pressing Return.
-
- You may move the lightbar to the right or left with the right
- and left arrow keys. The up and down arrow keys will work
- equally well. The PgUp and Home keys will move the light bar
- to the first option in the menu. The PgDn and End keys will
- move the lightbar to the end of the menu. You may also press
- the first letter in a word to hop to that word. The lightbar
- will wrap around at either end of the menu.
-
- To activate a choice, press the Return key.
-
- Some other lightbar menus will activate the choice when you
- press a letter. MGN forces you to use the Return key to
- confirm your choice. The advantage is that you may have
- several words with the same first letter in a submenu.
- Pressing that same letter will move the lightbar to another
- option. Try pressing and holding E in the main menu or W in
- the Editor* submenu of the sample menu.
-
- If the highlighted word ends with an asterisk, it means that
- this option will produce a submenu. If the word does not end
- with an asterisk, then pressing the Return key will let you
- quit the MGN program and return to the batch file.
-
- The sample MGN program produces a couple of pull-down,
- vertical submenus, a pull-up, vertical menu and a horizontal
- submenu. All of these appear to be attached to the main menu.
- They could just as well have been placed anywhere on the
- screen.
-
- When you are in a submenu, pressing ESC or moving the lightbar
- to one of the exit words and pressing Return, will move you
- back to the main menu. Pressing Return on any other word in a
- submenu program will halt the program's operation and return
- you to the batch file.
-
- DESIGNING YOUR OWN MENU DATA FILE.
-
- Here is a copy of the sample MGN.MNU file for discussion purposes.
-
- H 10 8 Spreadsheets* Editors* Calculators* Programming* Help Exit
- v 11 8 Quattro 1-2-3 AsEasyAs Quit
- v 11 23 Sprint WordPerfect WordStar VideoDispEd MicroStar Return
- V 6 33 PopCalc 41Emulator HP-12C Quit
- h 11 8 Pascal TASM TurboC Prolog Quit
-
- The first line of the MGN.MNU file contains the specifications
- for the main menu. Subsequent lines contain the specifications
- for the submenus. The second line contains the submenu choices
- corresponding to the first ItemWord in the main menu (Spread-
- sheets): the third line contains the submenu choices for the
- second ItemWord in the main menu, and so on.
-
- The first character in each line must be either H or V. Upper
- or lower case is acceptable. The second and third items are
- the row and column where you wish the menu to appear on the
- screen. The range of values are 1..25, 1..80, respectively.
- You may have to experiment with different values to prevent
- wraparound on the screen. There is no error trapping in the
- MGN program to prevent wraparound at the edges of the screen.
-
- The individual words indicate choices. The space is used as a
- delimiter. So, if you want to use the phrase MY DICTIONARY as
- an option, use either MyDictionary or MY-DICTIONARY.
-
- ItemWords, longer than 15 characters, will be truncated.
-
- If a word ends with an asterisk, MGN will try to hook it up
- with a submenu. If there is no such submenu, the program may
- hang and you will have to use CTRL-Break to quit.
-
- DESIGNING A BATCH FILE THAT USES MGN.EXE
-
- The M.BAT file is a sample batch file that uses MGN. Here is
- the first part of that file.
-
- echo off
- cls
- MGN MGN.MNU
- for %%e in (4 10 11 12 20 21 22 23 24 25) do if errorlevel=%%e SET opt=%%e
- for %%e in (30 31 32 40 41 42 43 255) do if errorlevel=%%e SET opt=%%e
- goto %opt%
- :255
- quit
- :43
- echo Pretending to use Prolog
- quit
- .
- .
- .
- etc
-
- The third line in the batch file calls the MGN program with
- the MGN.MNU file as a parameter.
-
- When MGN halts, it leaves behind an errorlevel number. The
- third and fourth lines test this errorlevel number. If the
- errorlevel is contained in the set of numbers inside the
- parentheses, then a DOS Environment variable (OPT) is SET to
- that errorlevel number. The fifth line fetches this number
- from the environment space and uses it to branch to the
- appropriate label in the batch file. Granted, this may appear
- obtuse and obfuscating, but these three lines take the place
- of at least 18 lines of the "If Errorlevel == " variety in a
- batch file. The multiple "quit" commands in the M.BAT file
- call the QUIT.BAT file. This is a quick and dirty way to exit
- from a long batch file.
-
- There is no error trap to account for insufficient DOS
- environment space.
-
- To determine which errorlevel numbers to use, follow these
- rules.
- a. In the main menu, the errorlevel numbers range from 0 to 9
- corresponding to the zeroth, first,...,ninth items (ten
- items in all.) Do NOT test for an errorlevel number, if
- that number corresponds to a starred (*) item.
- b. In the submenus, the errorlevel numbers range from 10 to 19
- for the first submenu: 20 to 29 for the second submenu,etc.
- Theoretically you could have up to 10 main choices and 80
- subchoices (not counting the Exit prompts.) In practice,
- this would be clumsy.
- c. The last item in the main menu and each submenu should be
- an Exit word (pick your favorite.)
- d. Test for the Exit word with the errorlevel number 255.
-
- MODIFYING MGN.PAS
-
- MGN (MenuEngine) comes with complete source code. Feel free to
- experiment with this. You will need Turbo Pascal 4 or 5 to
- recompile it.
-
- The code is pretty straight-forward, I think. There are no
- nested functions or procedures. The trickiest part in the
- code is the use of the paramstr() and paramcount operators to
- parse a line of text. This technique comes from the mind of
- Neil Rubenking.
-
- Several suggested modifications are included at the end of the
- source code file.
-
- #END#
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- The Public (Software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. The P(s)L cannot de-
- bug programs over the telephone.
-
- Disks in the P(s)L are updated monthly, so if you did not get
- this disk directly from the P(s)L, you should be aware that
- the files in this set may no longer be the current versions.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 1,800+ disks in the library, call or write
-
- The Public (Software) Library
- P.O.Box 35705 - F
- Houston, TX 77235-5705
- (713) 665-7017
-